//
//  NoteDetailCell.m
//  DogeLegs
//
//  Created by 宋华 on 2017/8/21.
//  Copyright © 2017年 宋华. All rights reserved.
//

#import "NoteDetailCell.h"

@interface NoteDetailCell () {

}

@property (weak, nonatomic) IBOutlet UIImageView *userLogoImageview;

@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;

@property (weak, nonatomic) IBOutlet UILabel *addNoteDateLabel;

@property (weak, nonatomic) IBOutlet UILabel *notePriceLabel;

@property (weak, nonatomic) IBOutlet UILabel *noteTitleLabel;

@property (weak, nonatomic) IBOutlet UILabel *noteContentLabel;

@end

@implementation NoteDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)cellWillDisplay:(NoteMode *)mode {
    //暂时这么写,图片要替换
    [self.userLogoImageview sd_setImageWithURL:[NSURL URLWithString:mode.userMode.headPortraitUrl] placeholderImage:[UIImage imageNamed:@"photo"]];
    [self.userNameLabel setText:mode.userMode.userName];
    [self.addNoteDateLabel setText:mode.noteDateStr];
    [self.notePriceLabel setText:mode.doallorPrice];
    [self.noteTitleLabel setText:mode.noteTitle];
    [self.noteContentLabel setText:mode.noteContent];
}

#pragma mark - 高度
+ (CGFloat)noteDetailCellHeight:(NoteMode *)mode {
    CGFloat totalHeight = 65;//固定高度
    //title高度
    CGFloat w = kContentMaxWidth;
    totalHeight += [mode.noteTitle sizeWithFont:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(w, 100000)].height;
    //内容高度
    totalHeight += [mode.noteContent sizeWithFont:[UIFont systemFontOfSize:12] maxSize:CGSizeMake(w, 100000)].height;
    return totalHeight;
}


@end
